Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for signaling an external process via pid file #118

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kfox1111
Copy link
Contributor

Partially implements: #115

@faisal-memon
Copy link
Collaborator

Hi @kfox1111 Thanks for the submission. The linter is complaining about io/ioutil. Looks good otherwise. A unit test for the new configurable would be nice if possible.

@faisal-memon faisal-memon added this to the 0.8.0 milestone Dec 20, 2023
@@ -153,6 +155,22 @@ func (s *Sidecar) updateCertificates(svidResponse *workloadapi.X509Context) {
// signalProcess sends the configured Renew signal to the process running the proxy
// to reload itself so that the proxy uses the new SVID
func (s *Sidecar) signalProcess() (err error) {
if s.config.PidFileName != "" {
atomic.StoreInt32(&s.processRunning, 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 1 is required inside processRunning?
it looks like it is to avoid if that is set bellow,
if that is the case I think we msut avoid this in order to simply the code and add this if as part of the switch, and run a signal there...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Really wasn't sure how to redo that switch, when honestly I wasn't exactly sure how it was working to begin with. Setting it to 1 let it fall through to the right path.

How should this be reworked?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a stab at reworking it.

pkg/sidecar/sidecar.go Outdated Show resolved Hide resolved
pkg/sidecar/sidecar.go Outdated Show resolved Hide resolved
@faisal-memon faisal-memon modified the milestones: 0.8.0, 0.9.0 Dec 20, 2023
err = cmd.Start()
if err != nil {
return fmt.Errorf("error executing process: %v\n%w", s.config.Cmd, err)
if s.config.Cmd != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move inside case nil

@faisal-memon faisal-memon modified the milestones: 0.9.0, 0.8.0 Apr 16, 2024
@kfox1111
Copy link
Contributor Author

Checking back in on this functionality. How do we get it moving again?

@faisal-memon
Copy link
Collaborator

Checking back in on this functionality. How do we get it moving again?

@kfox1111 Sorry for letting this slip.

Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants